<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100">

<!-- 页面容器 -->
<div class="max-w-6xl mx-auto p-6 bg-white rounded-lg shadow-md mt-10">

    <!-- 标题 -->
    <h3 class="text-2xl font-semibold text-gray-800 mb-4">用户列表</h3>

    <!-- 新增按钮 -->
    <div class="text-right mb-4">
        <a th:href="@{/sys/user/add}"
           sec:authorize="hasAuthority('sys:user:add')"
           class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition duration-300">
            新增
        </a>
    </div>

    <!-- 用户列表表格 -->
    <table class="min-w-full table-auto border-collapse">
        <thead>
        <tr>
            <th class="px-4 py-2 border-b text-left text-sm font-medium text-gray-700">ID</th>
            <th class="px-4 py-2 border-b text-left text-sm font-medium text-gray-700">用户名</th>
            <th class="px-4 py-2 border-b text-left text-sm font-medium text-gray-700">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="user : ${userList}">
            <td class="px-4 py-2 border-b text-sm text-gray-600" th:text="${user.id}"></td>
            <td class="px-4 py-2 border-b text-sm text-gray-600" th:text="${user.username}"></td>
            <td class="px-4 py-2 border-b text-sm">
                <a th:href="@{/sys/user/edit/{id}(id=${user.id})}"
                   sec:authorize="@ss.hasPermi('sys:user:edit')"
                   class="text-blue-600 hover:text-blue-800 transition duration-300">修改</a>
                <span class="mx-2 text-gray-400">|</span>
                <a th:href="@{/sys/user/del/{id}(id=${user.id})}"
                   sec:authorize="@ss.hasPermi('sys:user:del')"
                   class="text-red-600 hover:text-red-800 transition duration-300">删除</a>
            </td>
        </tr>
        </tbody>
    </table>

</div>

</body>
</html>
